import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  { path: '/', redirect: '/login' },
  { path: '/login', component: () => import('@/views/yddLogin.vue') },
  { path: '/register', component: () => import('@/views/yddRegister.vue') },
  {
    path: '/home',
    component: () => import('@/views/yddHome.vue'),
    children: [
      { path: '/', redirect: '/article' },
      { path: '/article', component: () => import('@/views/layout/article') },
      {
        path: '/classify',
        component: () => import('@/views/layout/classify')
      },
      {
        path: '/release',
        component: () => import('@/views/layout/release.vue')
      },
      { path: '/user', component: () => import('@/views/layout/user.vue') }
    ]
  },
  {
    path: '/articledetail/:id',
    component: () => import('@/views/articleDetail.vue')
  },
  {
    path: '/classlist/:id',
    component: () => import('@/views/ClassList.vue'),
    children: [
      { path: '/', redirect: 'pagelist/:id' },
      {
        path: 'pagelist/:id',
        component: () => import('@/views/layout/PageList.vue')
      }
    ]
  },
  {
    path: '/edituser',
    component: () => import('@/views/editUser.vue')
  }
]

const router = new VueRouter({
  routes
})

export default router
